package com.trimps.wifi.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trimps.wifi.common.Paginator;
import com.trimps.wifi.pojo.Device;
import com.trimps.wifi.service.IDevService;

@Controller
@RequestMapping(value = "map/")
public class MapController extends BaseController {
    private static final Logger logger = Logger.getLogger(MapController.class);

    @Autowired
    private IDevService devService;

    @RequestMapping(value = "map")
    public String showMapPage() {
        return "map/map";
    }
    
    @RequestMapping(value = "getAllDevices",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> getAllDevices(Paginator page)  {
     // 返回用
        Map<String, Object> map = new HashMap<String, Object>();
        List<Device> devices = devService.getAllDevice(0, Integer.MAX_VALUE);
        map.put("devices", devices);
        return map;
    }
    
}
